package controler;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JComboBox;

import dialog.HouseDialog;

public class BuyHouses implements ActionListener {
	HouseDialog hd;
	public BuyHouses(HouseDialog hd){
		this.hd=hd;
	}
	public void actionPerformed(ActionEvent e) {
		JComboBox< String>box = (JComboBox)e.getSource();
		if(hd.onglet.getSelectedIndex()==0){
			hd.family.removeAll();
			hd.family.add(hd.buildFamily(""+box.getSelectedItem()));
			hd.family.revalidate();
			hd.view();
			hd.onglet.setSelectedIndex(0);
		}
		else{
			hd.family2.removeAll();
			hd.family2.add(hd.buildSellFamily(""+box.getSelectedItem()));
			hd.family2.revalidate();
			hd.view();
			hd.onglet.setSelectedIndex(1);
		}		
	}
}
